/***************************************************************************
 *   Copyright (C) 2005 by xihe                                            *
 *   xihels@163.com                                                        *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef _BUDDY_INFO_H_
#define _BUDDY_INFO_H_
#include <string>
#include <memory>
#include <stdint.h>
using std::auto_ptr;
using std::string;

class QQSession;
class MsgPage;


#define DEFAULT_GROUP 0
#define STRANGER_GROUP_NUM 0x0fffffff
#define CLUSTER_GROUP_NUM -1
class BuddyInfo {
    public:
	uint32_t getUid() const		    { return uid; }
	const string& getNickname() const   { return nickname; }

	bool isCluster() const		    { return cluster; }
	
	bool isShowed() const		    { return showed; }
	void isShowed(bool _showed)	    { showed = _showed; }

	BuddyInfo(uint32_t _uid, bool _cluster) : 
	    uid(_uid),
	    msgPage(NULL),
	    cluster(_cluster),
	    showed(false)
	{}
	BuddyInfo(uint32_t _uid, const string& _nickname, bool _cluster) :
	    uid(_uid),
	    msgPage(NULL),
	    nickname(_nickname),
	    cluster(_cluster),
	    showed(false)
	{}

	BuddyInfo(const BuddyInfo& rhs)
	{
	    nickname = rhs.nickname;
	    msgPage  = NULL;
	    uid	     = rhs.uid;
	    cluster  = rhs.cluster;
	    showed   = false;
	}


	virtual ~BuddyInfo();

	void destroy() { delete this; }

	MsgPage* getMsgPage() { return msgPage; }
	void setMsgPage(MsgPage* page) { msgPage = page; }
	const MsgPage* getMsgPage() const { return msgPage; }

    private:
	BuddyInfo& operator = (const BuddyInfo& rhs); // 禁止拷贝 
    protected:
	string	    nickname; 
	MsgPage*    msgPage;
	uint32_t    uid; 
	bool	    cluster; 
	bool	    showed; 
};


class GroupInfo {
    public:

	bool isShowed() const		    { return showed; }
	void isShowed(bool _showed)	    { showed = _showed; }
	
	uint32_t getUid() const		    { return uid;}
	void setUid(uint32_t _uid)	    { uid = _uid; }

	const string& getNickname() const   { return nickname; }
	void setNickName(const string& _name) { nickname = _name; }
    public:

	GroupInfo(uint32_t _uid, const string& _name): 
	    uid(_uid),
	    nickname(_name),
	    showed(false)
	{}
	explicit GroupInfo(uint32_t _uid = 0x00000000) :
	    uid(_uid),
	    showed(false)
	{}
    private:
	friend class QQSession;
	void destroy() { delete this; }



	string   nickname;
	uint32_t uid;
	bool     showed;
};

#endif // _BUDDY_INFO_H_

